package com.dk.controller;


import com.dk.model.ProcedureSequence;
import com.dk.service.ProcedureSequenceService;
import com.dk.vo.ProcedureSequenceVO;
import com.dongdongshop.data.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.PostConstruct;
import java.util.List;

/**
 * <p>
 *  工序顺序 前端控制器
 * </p>
 *
 * @author wbh
 * @since 2023-03-20
 */
@RestController
@RequestMapping("procedureSequence")
public class ProcedureSequenceController {
    @Autowired
    private ProcedureSequenceService procedureSequenceService;


    @GetMapping("getInfoList")
    public Result getInfoList(String procedureId){
        List<ProcedureSequenceVO> procedureSequenceVOList = procedureSequenceService.getInfoList(procedureId);
        return Result.OK().setData(procedureSequenceVOList);
    }

    @PostMapping("insertInfoProcedureSequence")
    public Result insertInfoProcedureSequence(ProcedureSequenceVO procedureSequenceVO){
        procedureSequenceService.insertInfoProcedureSequence(procedureSequenceVO);
        return Result.OK();
    }

    @GetMapping("getInfoProcedureSequenceById")
    public Result getInfoProcedureSequenceById(Integer id){
        ProcedureSequenceVO procedureSequenceVO = procedureSequenceService.getInfoProcedureSequenceById(id);
        return Result.OK().setData(procedureSequenceVO);
    }

    @PostMapping("updateInfoProcedureSequenceById")
    public Result updateInfoProcedureSequenceById(ProcedureSequenceVO procedureSequenceVO){
        procedureSequenceService.updateInfoProcedureSequenceById(procedureSequenceVO);
        return Result.OK();
    }

    @PostMapping("deleteInfoProcedureSequenceById")
    public Result deleteInfoProcedureSequenceById(Integer id){
        procedureSequenceService.deleteInfoProcedureSequenceById(id);
        return Result.OK();
    }
}

